package emp.jsf.servicio.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import emp.entidades.EntRubro;
import emp.jsf.servicio.RubroService;
import emp.repositorios.RubroRepository;

@Service("rubroService")
public class RubroServiceImpl implements RubroService{
	
	@Autowired
	RubroRepository rubroRepository;
	
	public List<EntRubro> listarRubros(){
		return rubroRepository.findAll();
	}
	
	public EntRubro grabarRubro(EntRubro ent){
		return rubroRepository.saveAndFlush(ent);
	}
	
	public void eliminar(String id){
		EntRubro ent=rubroRepository.findOne(Long.valueOf(id));
		rubroRepository.delete(ent);
	}
 
	
}
